<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: lijincheng
  Date: 2021/5/10
  Time: 9:59 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>确认订单</title>
    <!-- CUSTOM STYLE -->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/order/style.css" rel="stylesheet">
    <!-- THEME TYPO -->
    <link href="/css/themetypo.css" rel="stylesheet">
    <!-- BOOTSTRAP -->
    <link href="/css/bootstrap.css" rel="stylesheet">
    <!-- COLOR FILE -->
    <link href="/css/color.css" rel="stylesheet">
    <!-- FONT AWESOME -->
    <link href="/css/font-awesome.min.css" rel="stylesheet">
    <!-- BX SLIDER -->
    <link href="/css/jquery.bxslider.css" rel="stylesheet">

    <link href="/css/bootstrap-slider.css" rel="stylesheet">

<%--
    <link href="/css/widget.css" rel="stylesheet">
--%>

    <link href="/css/shortcode.css" rel="stylesheet">
    <!-- responsive -->
    <link href="/css/responsive.css" rel="stylesheet">
    <!-- Component -->
    <link href="/js/dl-menu/component.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/css/order/css.css"/>
    <link rel="stylesheet" href="/css/order/tasp.css"/>
    <link href="/css/order/orderconfirm.css" rel="stylesheet"/>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <![endif]-->
    <style>
        .row {
            margin-bottom: 10px;
        }

        hr {
            margin-top: 10px;
        }

        .showMessage {
            padding: 5px 10px;
            border-radius: 5px;
            position: fixed;
            top: 45%;
            left: 45%;
            color: #ffffff;
        }

        .showMessageSuccess {
            background-color: #00B7EE;
        }
    </style>
</head>
<body>
<div id="loader-wrapper">
    <div id="loader"></div>

    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>

</div>
<!--WRAPPER START-->
<div class="wrapper kode-header-class-3">
    <!--HEADER START-->
    <header class="header-3">
        <div class="container">
            <div class="logo-container">
                <div class="row">
                    <div class="col-md-3">
                        <!--LOGO START-->
                        <div class="logo">
                            <a href="#"><img src="/images/logo-2.png" alt=""></a>
                        </div>
                        <!--LOGO END-->
                    </div>
                    <div class="col-md-9">
                        <div class="top-strip">
                            <div class="pull-left">
                                <p>Welcome to Library theme</p>
                            </div>
                            <div class="social-icon">
                                        <li><a href="#" class="pull-left">欢迎 ${sessionScope.user.getUName()}</a></li>

                            </div>
                        </div>
                        <<div class="kode-navigation">
                        <ul>
                            <li><a href="/">主页</a>
                                <ul>
                                    <li><a href="/">主页</a></li>
                                </ul>
                            </li>
                                    <li><a href="">图书管理</a>
                                        <ul>
                                            <li><a href="/ubook/post/index">发布图书</a></li>
                                            <li><a href="/ubook/myBooks">我的发布记录</a></li>
                                        </ul>
                                    </li>
                                    <li><a href="">购物车</a>
                                        <ul>
                                            <li><a href="/shop/car/index">我的购物车</a></li>
                                        </ul>
                                    </li>
                                    <li><a href="">订单管理</a>
                                        <ul>
                                            <li><a href="/order/index">所有订单</a></li>
                                            <li><a href="">待收货</a></li>
                                            <li><a href="">已完成</a></li>
                                        </ul>
                                    </li>
                                    <li><a href="">个人中心</a>
                                        <ul>
                                            <li><a href="/user/userInfo/#caa">个人信息</a></li>
                                            <li><a href="/browse/history/list">我的浏览记录</a></li>
                                            <li><a href="/user/loginout">退出登陆</a></li>
                                        </ul>
                                    </li>
                        </ul>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <!--HEADER END-->
    <!--BANNER START-->
    <div class="kode-inner-banner">
        <div class="kode-page-heading">
            <h2>Photo Gallery</h2>
            <ol class="breadcrumb">
                <li><a href="#">主页</a></li>
                <li class="active">确认订单</li>
            </ol>
        </div>
    </div>
    <!--BANNER END-->
    <!--CONTENT START-->
    <div class="kode-content">
        <!--TOP AUTHERS START-->
        <div class="container" style="width: 100%">
            <div class="Caddress">
                <div class="open_new" style="margin-right: 10%;float:right;">
                    <button class="open_btn" onclick="javascript:onclick_open_select_address();">选择地址</button>
                    <button class="open_btn" onclick="javascript:onclick_open();">使用新地址</button>
                </div>
                <div class="add_mi" id="address_ok"
                     style='background: url("/images/order/mail_1.jpg") no-repeat;float: left'>

                </div>
            </div>
            <div id="page" style="width: 80%">
                <form id="J_Form" name="J_Form" action="/auction/order/unity_order_confirm.htm" method="post">
                    <div>
                        <h3 class="dib">确认订单信息</h3>
                        <table cellspacing="0" cellpadding="0" class="order-table" id="J_OrderTable"
                               summary="统一下单订单信息区域">
                            <caption style="display: none">统一下单订单信息区域</caption>
                            <thead>
                            <tr>
                                <th class="s-title">图书
                                    <hr/>
                                </th>
                                <th class="s-price">单价(元)
                                    <hr/>
                                </th>
                                <th class="s-amount">数量
                                    <hr/>
                                </th>
                                <th class="s-agio">库存
                                    <hr/>
                                </th>
                                <th class="s-total">小计(元)
                                    <hr/>
                                </th>
                            </tr>
                            </thead>

                            <tbody data-spm="3" class="J_Shop" data-tbcbid="0" data-outorderid="47285539868"
                                   data-isb2c="false"
                                   data-postMode="2" data-sellerid="1704508670">
                            <tr class="shop blue-line">
                                <td colspan="5">
                                    <span class="seller">订单编号：<a id="orderNo">${orderNo}</a></span>
                                </td>
                            </tr>
                            <c:forEach items="${maps}" var="map">
                                <tr class="shop blue-line">
                                    <td colspan="5">
                                        <span class="seller">卖家：<a>${map.key}</a></span>
                                    </td>
                                </tr>
                                <c:forEach items="${map.value}" var="m">
                                    <tr class="item" data-lineid="19614514619:31175333266:35612993875" data-pointRate="0">
                                        <td class="s-title">
                                            <a href="#" target="_blank" title="${m.bookName}"
                                               class="J_MakePoint"
                                               data-point-url="http://log.mmstat.com/buy.1.5">
                                                <img src="/upload/${m.imgUrl}"
                                                     class="itempic" width="60" height="60"><span class="title J_MakePoint"
                                                                                                  data-point-url="http://log.mmstat.com/buy.1.5">${m.bookName}</span></a>

                                            <div class="props">
                                                <span>作者: ${m.bookAuthor} </span><br>
                                                <span>分类: ${m.category} </span>
                                                <input type="text" name="bookCode" hidden value="${m.bookCode}">
                                            </div>

                                        </td>
                                        <td class="s-price">

  <span class='price '>
 <em class="style-normal-small-black J_ItemPrice">${m.price}</em>
  </span>
                                            <input type="hidden" name="costprice" value="${m.price}" class="J_CostPrice"/>
                                        </td>
                                        <td class="s-amount" data-point-url="">
                                            <input type="hidden" class="J_Quantity" value="1"
                                                   name="19614514619_31175333266_35612993875_quantity"/>${m.num}

                                        </td>
                                        <td class="s-agio">
                                            <div class="J_Promotion promotion" data-point-url="">${m.isAmple}</div>
                                        </td>
                                        <td class="s-total">

   <span class='price '>
 <em class="style-normal-bold-red J_ItemTotal subTotal">${m.totalPrice}</em>
  </span>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:forEach>
                            <%--<tr class="shop blue-line">
                                <td colspan="3">
                        <span class="seller">卖家：<a>${book.userDto.UName}</a></span>
                                </td>
                            </tr>
                            <tr class="item" data-lineid="19614514619:31175333266:35612993875" data-pointRate="0">
                                <td class="s-title">
                                    <a href="#" target="_blank" title="${book.UBookDto.bookTitle}"
                                       class="J_MakePoint"
                                       data-point-url="http://log.mmstat.com/buy.1.5">
                                        <img src="/upload/${img}"
                                             class="itempic" width="60" height="60"><span class="title J_MakePoint"
                                                                                          data-point-url="http://log.mmstat.com/buy.1.5">${book.UBookDto.bookTitle}</span></a>

                                    <div class="props">
                                        <span>作者: ${book.UBookDto.bookAuthor} </span><br>
                                        <span>分类: ${book.firstCategory} > ${book.secondCategory} </span>
                                        <input type="text" id="book_code" hidden value="${book.UBookDto.bookCode}">
                                    </div>

                                </td>
                                <td class="s-price">

  <span class='price '>
 <em class="style-normal-small-black J_ItemPrice">${book.UBookDto.bookPrice}</em>
  </span>
                                    <input type="hidden" name="costprice" value="${book.UBookDto.bookPrice}" class="J_CostPrice"/>
                                </td>
                                <td class="s-amount" data-point-url="">
                                    <input type="hidden" class="J_Quantity" value="1"
                                           name="19614514619_31175333266_35612993875_quantity"/>1

                                </td>
                                <td class="s-agio">
                                    <div class="J_Promotion promotion" data-point-url="">无优惠</div>
                                </td>
                                <td class="s-total">

   <span class='price '>
 <em class="style-normal-bold-red J_ItemTotal ">${book.UBookDto.bookPrice}</em>
  </span>
                                    <input id="furniture_service_list_b_47285539868" type="hidden"
                                           name="furniture_service_list_b_47285539868"/>
                                </td>
                            </tr>
                            --%><tr class="other other-line">
                                <td colspan="5">
                                    <ul class="dib-wrap">
                                        <li class="dib user-info">
                                            <ul class="wrap">
                                                <li>
                                                    <div class="field gbook">
                                                        <label class="label" style="color:black">给卖家留言：</label>
                                                        <textarea style="width:350px;height:80px;" id="note"
                                                                  title="选填：对本次交易的补充说明（建议填写已经和卖家达成一致的说明）"
                                                                  name=""></textarea>
                                                    </div>
                                                </li>
                                            </ul>
                                        </li>
                                        <li class="dib extra-info">
                                            <div class="farearea">
                                                <ul class="dib-wrap J_farearea">
                                                    <li class="dib title">运送方式：</li>
                                                    <li class="dib sel"
                                                        data-point-url="http://log.mmstat.com/jsclick?cache=*&tyxd=wlysfs">
                                                        <select style="margin-top: 6px" class="J_Fare" id="payType">
                                                            <option value="1" selected="selected">
                                                                送货上门 10.00元
                                                            </option>
                                                            <option value="2">
                                                                上门自取 0.00元
                                                            </option>
                                                        </select>
                                                    </li>
                                                    <li class="dib fee">  <span class='price'>
 <em class="style-normal-bold-red J_FareSum" id="fee_price">10.00</em>
  </span>
                                                    </li>
                                                </ul>
                                            </div>
                                            <div class="extra-area">
                                                <ul class="dib-wrap">
                                                    <li class="dib title">发货时间：</li>
                                                    <li class="dib content">送/取图书时间、地点自行与卖家联系</li>
                                                </ul>
                                            </div>
                                            <div class="servicearea" style="display: none"></div>
                                        </li>
                                    </ul>
                                </td>
                            </tr>

                            <tr class="shop-total blue-line">
                                <td colspan="5">店铺合计(<span class="J_Exclude">不</span>含运费<span
                                        class="J_ServiceText" style="display: none">，服务费</span>)：
                                    <span class='price g_price '>
 <span>&yen;</span><em class="style-middle-bold-red J_ShopTotal" id="total_price"></em>
  </span>
                                    <input type="hidden" name="1704508670:2|creditcard" value="false"/>
                                    <input type="hidden" id="J_IsLadderGroup" name="isLadderGroup" value="false"/>

                                </td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="5">

                                    <div class="order-go" data-spm="4">
                                        <div class="J_AddressConfirm address-confirm">
                                            <div class="kd-popup pop-back" style="margin-bottom: 40px;">
                                                <div class="box">
                                                    <div class="bd">
                                                        <div class="point-in">

                                                            <em class="t">实付款：</em> <span class='price g_price '>
 <span>&yen;</span><em class="style-large-bold-red" id="J_ActualFee">20.0</em>
  </span>
                                                        </div>

                                                        <ul>
                                                            <li><em>送至:</em><span id="J_AddrConfirm"
                                                                                   style="word-break: break-all;">
    七公寓459
   </span></li>
                                                            <li><em>收货人:</em><span id="J_AddrNameConfirm">测试1 132****2134 </span>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <a id="J_Go" class=" btn-go" data-point-url="" tabindex="0"
                                                   title="点击此按钮，提交订单。">提交订单<b
                                                        class="dpl-button"></b></a>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>

                    <input type="hidden" id="J_useSelfCarry" name="useSelfCarry" value="false"/>
                    <input type="hidden" id="J_selfCarryStationId" name="selfCarryStationId" value="0"/>
                    <input type="hidden" id="J_useMDZT" name="useMDZT" value="false"/>
                    <input type="hidden" name="useNewSplit" value="true"/>
                    <input type="hidden" id="J_sellerIds" name="allSellIds" value="1704508670"/>
                </form>
            </div>
            <div class="shade">
            </div>

            <div class="shade_content">
                <div class="col-xs-12 shade_colse">
                    <a style="font-size: 30px" onclick="javascript:onclick_close();">x</a>
                </div>
                <div class="nav shade_content_div">
                    <div class="col-xs-12 shade_title">
                        新增收货地址
                    </div>
                    <div class="col-xs-12 shade_from">
                        <form action="" method="post">
                            <div class="col-xs-12">
                                <span class="span_style" id="a">详细地址</span>
                                <input class="input_style" type="" name="" id="address" value=""
                                       placeholder="&nbsp;&nbsp;请输入您的详细地址"/>
                            </div>
                            <div class="col-xs-12">
                                <span class="span_style" class="span_sty" id="c">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</span>
                                <input class="input_style" type="" name="" id="name" value=""
                                       placeholder="&nbsp;&nbsp;请输入您的姓名"/>
                            </div>
                            <div class="col-xs-12">
                                <span class="span_style" id="d">手机号码</span>
                                <input class="input_style" type="" name="" id="phone" value=""
                                       placeholder="&nbsp;&nbsp;请输入您的手机号码"/>
                            </div>
                            <div class="col-xs-12">
                                <input class="btn_remove" type="button" id="e" onclick="javascript:onclick_close();"
                                       value="取消"/>
                                <input type="button" class="sub_set" id="sub_setID" value="提交"/>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

            <div class="shade_address_list">
                <div class="col-xs-12 shade_colse">
                    <a style="font-size: 30px" onclick="javascript:onclick_close_select_address();">x</a>
                </div>
                <hr>
                <div class="Caddress col-md-12" id="addressListShade"
                     style="height:auto;height: 300px;overflow:auto;width: 100%">
                    <c:forEach items="${addressList}" var="add">
                        <div class="add_mi" style="margin-right: 6px;margin-bottom: 4px">
                            <a hidden>${add.id}</a>
                            <p style="border-bottom:1px dashed #ccc;padding-bottom: 3px"><a href="javascript:edit_address_open('${add.id}')"><span
                                    class="btn btn-info"
                                    style="width: 40px;height: 20px;line-height:20px;font-size: 10px;padding: 0">编辑</span></a>
                                <a href="javascript:delete_address('${add.id}')"><span class="btn btn-danger"
                                                 style="width: 40px;height: 20px;line-height:20px;font-size: 10px;padding: 0">删除</span></a>
                            </p>
                            <p style="border-bottom:1px dashed #ccc;line-height:28px;">${add.recName} </p>
                            <p>${add.recAddress} ${add.recPhone}</p>
                        </div>
                    </c:forEach>
                </div>
                <div class="col-md-12" style="text-align: right">
                    <button class="btn btn-danger" onclick="javascript:onclick_close_select_address();">关闭</button>
                    <button class="btn btn-primary" onclick="javascript:onclick_close_select_address();">确定</button>
                </div>
            </div>

        </div>
        <!--TOP AUTHERS END-->
    </div>
    <div class="edit-address-div card" id="edit-div">
        <input type="text" id="editAddressId" hidden>
        <div class="col-xs-12 shade_colse">
            <a style="font-size: 30px" onclick="javascript:edit_address_close()">x</a>
        </div>
        <div class="nav shade_content_div">
            <div class="col-xs-12 shade_title">
                修改收货地址
            </div>
            <div class="col-xs-12 shade_from">
                <form action="" method="post">
                    <div class="col-xs-12">
                        <span class="span_style" >详细地址</span>
                        <input class="input_style" type="" name="" id="edit_address_detail" value=""
                               placeholder="&nbsp;&nbsp;请输入您的详细地址"/>
                    </div>
                    <div class="col-xs-12">
                        <span class="span_style" class="span_sty" >姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</span>
                        <input class="input_style" type="" name="" id="edit_address_concat" value=""
                               placeholder="&nbsp;&nbsp;请输入您的姓名"/>
                    </div>
                    <div class="col-xs-12">
                        <span class="span_style" >手机号码</span>
                        <input class="input_style" type="" name="" id="edit_address_phone" value=""
                               placeholder="&nbsp;&nbsp;请输入您的手机号码"/>
                    </div>
                    <div class="col-xs-12">
                        <input class="btn_remove" type="button" onclick="javascript:edit_address_close()"
                               value="取消"/>
                        <input type="button" class="sub_set" id="edit_address_btn_ok"  value="提交"/>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--CONTENT END-->
    <div class="copyrights">
        <div class="container">
            <p>Copyrights © 2015-16 KodeForest. All rights reserved</p>
            <div class="cards"><img src="/images/cards.png" alt=""></div>
        </div>
    </div>
</div>
<!--WRAPPER END-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="/js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="/js/bootstrap.min.js"></script>
<script src="/js/dl-menu/modernizr.custom.js"></script>
<script src="/js/dl-menu/jquery.dlmenu.js"></script>
<script src="/js/jquery.bxslider.min.js"></script>
<script src="/js/bootstrap-slider.js"></script>
<script src="/js/waypoints.min.js"></script>
<script src="/js/jquery.counterup.min.js"></script>
<script src="/js/functions.js"></script>
<script type="text/javascript">
    var add_value = null;
    $(function () {
        $("#address_ok").hide();
        $(".edit-address-div").hide();
        $(".shade_content").hide();
        $(".shade").hide();
        $(".shade_address_list").hide();
        $('.nav_mini ul li').hover(function () {
            $(this).find('.two_nav').show(100);
        }, function () {
            $(this).find('.two_nav').hide(100);
        })
        $('.left_nav').hover(function () {
            $(this).find('.nav_mini').show(100);
        }, function () {
            $(this).find('.nav_mini').hide(100);
        })
        $('#jia').click(function () {
            $('input[name=num]').val(parseInt($('input[name=num]').val()) + 1);
        })
        $('#jian').click(function () {
            $('input[name=num]').val(parseInt($('input[name=num]').val()) - 1);
        })
        $('.Caddress .add_mi').click(function () {
            $(this).css('background', 'url("/images/order/mail_1.jpg") no-repeat').siblings('.add_mi').css('background', 'url("/images/order/mail.jpg") no-repeat')
            var a_val = $(this).find('a');
            var p_val = $(this).find('p');
            add_value = '<a hidden id="idVal">' + a_val[0].innerText + '</a>';
            add_value += '<p style="border-bottom:1px dashed #ccc;line-height:28px;">' + p_val[1].innerText + '</p>';
            let s = new Array();
            s = p_val[2].innerText.split(' ');
            add_value += '<p">' + s[0] + '</p>';
            add_value += '<p">' + s[1] + '</p>';
            $("#J_AddrConfirm").text(s[0]);
            $("#J_AddrNameConfirm").text(p_val[1].innerText+" "+s[1]);
        })
    })

    function onclick_close() {
        var shade_content = $(".shade_content");
        var shade = $(".shade");
        if (confirm("确认关闭么！此操作不可恢复")) {
            shade_content.hide();
            shade.hide();
        }
    }

    function onclick_close_ok() {
        var shade_content = $(".shade_content");
        var shade = $(".shade");
        shade_content.hide();
        shade.hide();
    }

    function onclick_open() {
        $(".shade_content").show();
        $(".shade").show();
        var input_out = $(".input_style");
        for (var i = 0; i <= input_out.length; i++) {
            if ($(input_out[i]).val() != "") {
                $(input_out[i]).val("");
            }
        }
    }

    function onclick_open_select_address() {
        $(".shade_address_list").show();
        $(".shade").show();
    }

    function onclick_close_select_address() {
        $("#address_ok").html(add_value);
        $("#address_ok").show();
        $(".shade_address_list").hide();
        $(".shade").hide();
    }

    $("#payType").change(function () {
        var f = $("#payType").val();
        if (f == 1) {
            $("#fee_price").text('10.00')
        } else {
            $("#fee_price").text('0.00')
        }
    });

    function delete_address(addressId) {
        if (confirm("确定删除？")) {
            $.ajax({
                type: "GET",
                data: {"id": addressId},
                url: "" / address / delete "",
                success: function (data) {
                    showMessage("删除成功", 1);
                    refreshAddress();
                },
                error: function () {

                }
            });
        }
    }

    function edit_address_open(id) {
        $(".shade").show();
        $(".edit-address-div").show();
        $("#editAddressId").val(id);
        getAddressId(id);
    }

    function edit_address_close() {
        $(".shade").hide();
        $(".edit-address-div").hide();

    }

    function edit_address() {
        var params = {
            "id": $("#editAddressId").val(),
            "recAddress": $("#edit_address_detail").val(),
            "recName": $("#edit_address_concat").val(),
            "recPhone": $("#edit_address_phone").val()
        };

        $.ajax({
            type:"POST",
            data:params,
            url:"/address/editAddress",
            success:function (data){
                var aList = data.data;
                textAddressList(aList);
            }
        });
    }

    function getAddressId(id) {
        $.ajax({
            type: "GET",
            data: {"id": id},
            url: "/address/getAddress",
            success: function (data) {
                var a = data.data;
                $("#edit_address_detail").val(a.recAddress);
                $("#edit_address_concat").val(a.recName);
                $("#edit_address_phone").val(a.recPhone);
            }
        });
    }

    $("#edit_address_btn_ok").click(function (){
        edit_address();

        edit_address_close();
    });

    function showMessage(message, type) {
        let messageJQ = $("<div class='showMessage'>" + message + "</div>");
        messageJQ.addClass("showMessageError");
        messageJQ.hide().appendTo("body").slideDown(600);
        window.setTimeout(function () {
            messageJQ.remove();
        }, 1500);
    }

    function refreshAddress() {
        $.ajax({
            type: "GET",
            url: "address/list",
            success: function (data) {
                console.log(data);
                var addrList = data.data;
                textAddressList(addrList);
            }
        });
    }


    function textAddressList(addrList){
        var addrText = '';
        for (let i = 0; i < addrList.length; i++) {
            var a = addrList[i];
            addrText += '<div class="add_mi" style="margin-right: 6px;margin-bottom: 4px">\n' +
                '                            <a hidden id="addressId">' + a.id + '</a>\n' +
                '                            <p style="border-bottom:1px dashed #ccc;padding-bottom: 3px"><a href="javascript:edit_address_open(\''+a.id+'\')"><span\n' +
                '                                    class="btn btn-info" \n' +
                '                                    style="width: 40px;height: 20px;line-height:20px;font-size: 10px;padding: 0">编辑</span></a>\n' +
                '                                <a href="javascript:delete_address(\'' + a.id + '\')"><span class="btn btn-danger" \n' +
                '                                                 style="width: 40px;height: 20px;line-height:20px;font-size: 10px;padding: 0">删除</span></a>\n' +
                '                            </p>\n' +
                '                            <p style="border-bottom:1px dashed #ccc;line-height:28px;">' + a.recName +  '</p>\n' +
                '                            <p>' + a.recAddress + ' ' + a.recPhone + '</p>\n' +
                '                        </div>';
        }
        $("#addressListShade").html(addrText);
    }

    $("#sub_setID").click(function (){
        var name = $("#name").val();
        var phone = $("#phone").val();
        var address= $("#address").val();
        $.ajax({
            type:"POST",
            data:{"recName":name,"recPhone":phone,"recAddress":address},
            url:"/address/addAddress",
            success:function (data){
                if (data.code == 0){
                    alert("添加成功");
                    $(".shade_content").hide();
                    $(".shade").hide();
                }else {
                    alert(data.msg);
                }
            }
        });
    });
    $("#J_Go").click(function (){
        var addressId = $("#idVal").text();
        var bookCode = $("#book_code").val();
        var price = $("#J_ActualFee").text();
        var note = $("#note").val();
        if (addressId == null || addressId.length == 0){
            alert("请选择地址");

        }
        else {
            $.ajax({
                type: "POST",
                data: {
                    "orderCode": $("#orderNo").text(),
                    "addressId": addressId,
                    "orderPrice": price,
                    "orderNote": note,
                    "payType": $("#payType").val()
                },
                url: "/order/saveOrder",
                success: function (data) {
                    console.log(data);
                    window.location.href = "/order/index";
                }
            });
        }
    });

    function getTotalPrice(){
        var p1= $("#fee_price").text();
        var p2 = $("#total_price").text();
        $("#J_ActualFee").text(parseFloat(p1)+parseFloat(p2));
    }

    $("#payType").change(function (){
        getTotalPrice();
    });

    function subTotal(){
        var subTotal = 0;
        $(".subTotal").each(function (){
            subTotal += parseFloat($(this).text());
        });
        $("#total_price").text(subTotal);
    }
    subTotal();
    getTotalPrice();
</script>

</body>
</html>
